/*
 * 程序改错v2.0（5分）
 *
 * v1.0见04-week04/3_Find_Error_in_Code_v1.c
 */

#include<stdio.h>

int main() {
	setbuf(stdout, NULL);

	int score, get_return = 0;
	char grade;

	do {
		printf("Please input score:\n");
		get_return = scanf("%d", &score);
		while (getchar() != '\n');
		if (get_return != 1 || score > 100 || score < 0) {
			printf("Input error!\n");
		}
	} while (get_return != 1 || score > 100 || score < 0);

	if (score >= 90)
		grade = 'A';
	else if (score >= 80)
		grade = 'B';
	else if (score >= 70)
		grade = 'C';
	else if (score >= 60)
		grade = 'D';
	else
		grade = 'E';

	printf("grade:%c\n", grade);

	return 0;
}
